package com.uikoo9.manage.y.controller;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.uikoo9.util.jfinal.QController;
import com.uikoo9.util.jfinal.ucenter.model.UcenterUserModel;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: lb.kong
 * Date: 16-4-24
 * Time: 上午1:10
 * To change this template use File | Settings | File Templates.
 */
public class YController extends QController {

    public void saveRecord(String table,Record record){
        Db.save(table, setUserInfo(record));
    }

    private Record setUserInfo(Record record){
        UcenterUserModel user = (UcenterUserModel)getAttr("user");
        record.set("cdate", new Date());
        record.set("cuser_id", user.get("id"));
        record.set("cuser_name", user.get("ucenter_user_name"));

        return record;
    }


}
